import * as __ from '../assets/plugins/underscore.js';
export module MlcEnum {
	export enum GoodsNavType {
		分类 = 0,
		品牌 = 1,
		标签 = 2,
		关键词 = 3,
		商品 = 4,
		固定 = 98,
		索引 = 99
	}

	export enum ContentType {
		商品 = 0
	}
	export enum PayMode {
		线下支付 = 0,
		微信支付 = 1,
		支付宝支付 = 2,
		网银支付 = 3
	}
	export enum OrderStauts {
		待付款 = 0,
        待发货 = 1,
        待收货 = 2,
        已完成 = 3,
        已取消 = 4,
        已过期 = 5,
        已关闭 = 6
	}
	export enum OrderPayMode {
		线下支付,
		微信支付,
		支付宝 
	}

	export enum PayRecordStatus {
		付款中 = 0,
		已完成 = 1,
		已放弃 = 2
	}
	export enum SmsType {
		注册 = 0,
		找回密码 = 1,
		普通 = 2,
	}

	export enum GoodsOrder {
		综合 = 0,
		价格 = 1,
		销量 = 2,
	}

	export enum UserEnterpriseStatus {
		未提交 = -1,
		等待审核 = 0,
		审核通过 = 1,
		审核未通过 = 2
	}

	export enum OrderRefundStatus {
		等待确认 = 0,
		等待返仓 = 1,
		等待返款 = 2,
		已完成 = 3,
		等待买家发货 = 4,
		被退回 = 97,
		异常 = 98,
		已取消 = 99
	}

	export enum AfterServiceStatus {
		待处理 = 0,
		处理中 = 1,
		已完成 = 2,
		已取消 = 3
	}

	export let conver = function <T>(val) {
		if (!__.isFinite(val)) {
			return undefined;
		}
		val = parseInt(val.toString(), 10);
		return <T>val;
	}

	export let toArray = function
	(key: 'OrderStauts'
			| 'OrderStauts'
			| 'PayMode'
			| 'InvoiceType'
			| 'InvoiceMode'
			| 'InvoiceContent'
			| 'InvoiceUnit'
			| 'InvoiceStatus'
		)
		: Array<string> {
		let result: Array<string> = [];
		switch (key) {
			case 'PayMode':
				result = __.keys(PayMode).filter((val) => {
					return !__.isFinite(val);
				});
				break;
			case 'OrderStauts':
				result = __.keys(OrderStauts).filter((val) => {
					return !__.isFinite(val);
				});
				break;
		}
		return result;
	}
}
